$(document).ready(function () {

    let v_fixed_active = $('.v-fixed')
    // console.log(v_fixed_active)
    let sl_b_letter = $('.sl-b-letter')//所有品牌字母列表块
    let count = 0

    let s_brand = $('.s-brand')
    let sl_b_more = s_brand.find('.sl-e-more')

    // console.log(sl_b_more)
    //点击更多展开logo/ul
    sl_b_more.mousedown(function () {
        if (count===0){
            v_fixed_active.addClass('active')
            sl_b_letter.css('display', 'block')
            count++
        }else {
            v_fixed_active.removeClass('active')
            sl_b_letter.css('display', 'none')
            count--
        }
    });
    //  展开收起其它三个ul
    let num =0
    let sl_l_more = $('.s-line .sl-e-more')
    // console.log(sl_l_more)
    sl_l_more.click(function () {
        let $this = $(this)
        let this_ul = $this.parent().parent().find('ul')

        if (num===0){
            this_ul.css('height','auto')
            num++
        }else {
            this_ul.css('height','30px')
            num--
        }
    });

    //所有品牌A B C ...
    let sl_b_letter_li = $('.sl-b-letter li')
    // console.log(sl_b_letter_li)
    sl_b_letter_li.hover(function () {
        let $this = $(this)
        sl_b_letter_li.removeClass('active')
        $this.addClass('active')
    });

    //切换图片
    let goods_list = $('.g-main2 .m-list .goods-list .gl-wrap .gl-item')
    let goods_images_li = goods_list.find('.ps-item')
    // console.log(goods_list.find('.ps-item'))

    goods_images_li.mouseover(function () {
        let $this = $(this)
        let this_ul_li = $this.parent().parent().find('.ps-item')
        this_ul_li.removeClass('active')
        $this.addClass('active')
        let this_goodsBox_img = $this.parent().parent().parent().parent().find('.p-img img')
        this_goodsBox_img.attr('src',$this.find('img').attr('src'))
    });
})